package com.wuliu.servlet;

import com.wuliu.dao.OrdersDAO;
import com.wuliu.dao.impl.OrdersDAOImpl;
import com.wuliu.model.Orders;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/admin/orders")
public class AdminOrdersServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        OrdersDAO ordersDAO=new OrdersDAOImpl();
        List<Orders> ordersList= ordersDAO.findAll();
        System.out.println(ordersList);
        req.setAttribute("ordersList",ordersList);
        req.getRequestDispatcher("/WEB-INF/view/admin/orders.jsp").forward(req,resp);
    }
}
